<template>
  <div id="searchRecord">
    <div class="lis" v-for="(item, index) in info" :key="index">
      <div class="top">
        <div class="img">
          <img :src="item.avatar" alt="" />
        </div>
        <div class="top_user">
          <div class="top_user_left">
            <div class="top_user_left_name">
              <div class="name">{{ item.nickname }}</div>
              <div class="leave">{{ item.level_name }}</div>
            </div>
            <div class="top_user_left_card">ID:{{ item.uid }}</div>
          </div>
          <div class="top_user_right">
            <i class="iconfont icon-card_weixin1" v-if="set.wechat && item.wechat" v-clipboard:copy="item.wechat" v-clipboard:success="onCopy"></i>
            <i class="iconfont icon-card_phone" v-if="set.phone && item.mobile" @click="telCall(item.mobile)"></i>
          </div>
        </div>
      </div>
      <div class="contenBox">
        <div class="list listTd">
          <div class="left">订单数：{{ item.self_total_order }}个</div>
          <div class="right">订单总额：{{ item.self_total_price }}元</div>
        </div>
        <div class="list listad">
          <div class="left">客户数量：{{ item.team_num }}个</div>
          <div class="right">客户订单：{{ item.child_total_price }}元</div>
        </div>
        <div class="bottom">
          <div class="time">{{ item.createtime }}</div>
          <div class="txt">
            <div class="txtName" @click="tapRecord(item.uid)" v-show="open_browse_footprint">轨迹追踪</div>
            <div class="txtName" @click="tapUserDetail(item.uid)" v-show="open_user_info_button">用户信息</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { Toast } from "vant";
export default {
  props: {
    info: {
      type: Array,
      default: () => {
        [];
      }
    },
    set: {
      type: Object,
      default: {}
    },
    open_user_info_button: {
      type: Boolean
    },
    open_browse_footprint: {
      type: Boolean
    }
  },
  data() {
    return {};
  },
  activated() {},
  methods: {
    tapUserDetail(uid) {
      this.$router.push(this.fun.getUrl("customerCenterUser", { id: uid }));
    },
    onCopy() {
      Toast({
        message: "复制成功",
        position: "bottom",
        duration: 1500
      });
    },
    tapRecord(uid) {
      this.$router.push(this.fun.getUrl("customerCenterRecord", { id: uid }));
    },
    telCall(phone) {
      window.location.href = `tel://${phone}`;
    }
  }
};
</script>
<style lang="scss" scoped>
.lis {
  border-bottom: 1px solid #e7e7e7;
  padding: 1rem 0;

  .contenBox {
    font-size: 0.8125rem;
    color: #666;

    .bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .time {
        font-size: 0.75rem;
        color: #999;
      }

      .txt {
        display: flex;
        color: #999;
        font-size: 0.75rem;
        color: #02bbff;

        .txtName {
          margin-right: 0.3125rem;
        }
      }
    }

    .listTd {
      margin-top: 0.8125rem;
    }

    .listad {
      margin-top: 0.5rem;
      margin-bottom: 0.75rem;
    }

    .list {
      display: flex;

      .left {
        flex: 1;
        text-align: left;
      }

      .right {
        flex: 1;
        text-align: left;
      }
    }
  }

  .top {
    display: flex;

    .top_user {
      flex: 1;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .top_user_left {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: flex-start;

        .top_user_left_name {
          display: flex;

          .name {
            font-size: 0.8125rem;
            color: #333;
            font-weight: bold;
          }

          .leave {
            padding: 0.125rem 0.625rem;
            border-radius: 12px;
            background: var(--themeBaseColor);
            color: #fff;
            margin-left: 0.25rem;
          }
        }

        .top_user_left_card {
          font-size: 0.75rem;
          color: #999;
        }
      }

      .top_user_right {
        .iconfont {
          font-size: 1.3rem;
          color: var(--themeBaseColor);
        }

        .icon-card_weixin1 {
          margin-right: 0.625rem;
        }
      }
    }

    .img {
      flex-shrink: 0;
      width: 2.25rem;
      height: 2.25rem;
      border-radius: 100%;
      margin-right: 0.5rem;

      img {
        width: 100%;
        height: 100%;
        border-radius: 100%;
      }
    }
  }
}
</style>